<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="1200px" @open="open" @close="close">
    <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="150px" :disabled="disableEditSubmit">
			<el-row>
				<el-col :span="12">
					<el-form-item label="项目" prop="projectid"  :rules="rules.validateRequire">
						<el-input v-model="model.projectid" :disabled="true" class="tl-ref-selector">
							<el-button slot="append" type="primary" icon="el-icon-search" @click="openpmProjectRefDialog" v-if="!disableEditSubmit"></el-button>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="项目编号" prop="projectcode" >
						<el-input v-model="model.projectcode"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="发票申请单ID" prop="invoiceapplyid" >
						<el-input-number v-model="model.invoiceapplyid" controls-position="right" :step="1" :min="0" style="width:100%"></el-input-number>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="发票申请单据编号" prop="invoiceapplydocno" >
						<el-input v-model="model.invoiceapplydocno"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="发票日期" prop="invoicedate" >
						<el-date-picker v-model="model.invoicedate" type="date" placeholder="发票日期" value-format="yyyy-MM-dd"></el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="发票号码" prop="invoiceno" >
						<el-input v-model="model.invoiceno"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="发票金额" prop="invoicebillmoney" >
						<el-input v-model="model.invoicebillmoney"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="是否作废" prop="iscancel" >
						<el-select v-model="model.iscancel" filterable clearable>
							<el-option v-for="item in codeModel.iscancelList" :key="item.code" :label="item.name" :value="item.code" />
						</el-select>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="排序码" prop="sortcode">
						<el-input-number v-model="model.sortcode" controls-position="right" :step="1" :min="0" style="width:100%"></el-input-number>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="有效" prop="enabled">
						<el-radio-group v-model="model.enabled">
							<el-radio :label="parseInt(item.code)" v-for="item in codeModel.enabledList" :key="item.code">{{ item.name }}</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
			</el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
    </div>
		<tlpm-project-ref ref="pmProjectRef" @confirm="getpmProjectRefData" :isSingleSelect="true"></tlpm-project-ref>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
/** 子组件 */
import tlpmProjectRef from '@/views/ProjectManage/pmProject/refList.vue'
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { tlpmProjectRef },
  data() {
    return {
      moduleTitle: '项目开票记录',
      urlPrefix: '/pm/invoiceRecord/',
      url: {
        // 额外的url
      }
    }
  },
  methods: {
    loaded() {
      // 页面加载完毕执行
    },
		/** 打开项目参照 */
		openpmProjectRefDialog() {
			this.$refs.pmProjectRef.visible = true
		},
		/** 获取项目参数数据 */
		getpmProjectRefData(selectionRow, selectKey, selectionValue) {
			this.$set(this.model, 'projectid', selectionRow.id)
		}
  }
}
</script>

